Skip to main content

Lifecycle Methods

Catalyst provides several methods to handle different stages of the SSR lifecycle, allowing for more fine grain control over the flow

Functions

  1. preServerInit - Triggers before starting the server.
  2. onServerError - Triggered if the SSR server fails to start or encounters a critical error. Useful for handling server initialization issues.
  3. onRouteMatch - Called after route matching attempts, regardless of whether a match was found or not. This method enables you to handle both successful and failed route matches
  4. onFetcherSuccess - Triggered after running a container's serverFetcher (currently running for both success and failure case)
  5. onRenderError - Executes when the rendering process encounters an error. This allows you to handle any failures during component rendering.
  6. onRequestError - Executes if any error occurs while handling the document request (think of it like the outer most catch block)

All these functions can be defined in and exported from server/index.js

export const preServerInit = () => {}